import { defHttp } from '/@/utils/http/axios';

enum Api {
  list = '/reconciliation/salesman/info',
  save = '/reconciliation/salesman/uploadEditPolicy',
  edit = '/reconciliation/salesman/uploadEditPolicy',
  confirm = '/reconciliation/salesman/confirmPolicy',
  synchronizeLastMonth = '/reconciliation/salesman/synchronizeLastMonth',
}

/**
 * 列表接口
 * @param params CHECKING
 */
export const list = (params) => {
  return defHttp.post({ url: Api.list, params });
};

/**
 * 同步上个月数据
 */
export const synchronizeLastMonth = () => {
  return defHttp.post({ url: Api.synchronizeLastMonth });
};

export const confirm = (params) => {
  return defHttp.post({ url: Api.confirm, params });
};

/**
 * 保存或者更新
 * @param params
 * @param isUpdate
 */
export const saveOrUpdate = (params, isUpdate) => {
  const url = isUpdate ? Api.edit : Api.save;
  return defHttp.post({ url: url, params }, { isTransformResponse: false });
};
